'use strict';

const Controller = require('egg').Controller;

class ControllerRegisterController extends Controller {
  async controllerRegister() {
    const { ctx } = this;
    const data = {
      username: ctx.request.body.username,
      phone: ctx.request.body.phone,
      password: ctx.request.body.password,
    };
    const res = await this.ctx.service.serviceRegister.postRegisterData(data);
    if (res.code === 1) {
      ctx.status = 200;
      ctx.body = {
        data: "注册成功",
      };
    } else {
      ctx.status = 400;
      ctx.body = { message: res.message };
    }

  }
}

module.exports = ControllerRegisterController;
